"""

用户相关的序列化器集
"""
from rest_framework import serializers
from users.models import User, Addr, City


class UserSerializer(serializers.ModelSerializer):
    """ 用户模型序列化器 """

    class Meta:
        model = User
        fields = ['id', 'username', 'email', 'mobile', 'avatar', 'last_name']


class AddrSerializer(serializers.ModelSerializer):
    """ 收货地址序列化器 """

    class Meta:
        model = Addr
        fields = '__all__'


class CitySerializer(serializers.ModelSerializer):
    """ 城市 """

    class Meta:
        model = City
        fields = ['id', 'parentid', 'name', 'leveltype', 'citycode']
